const Joi = require("joi");
module.exports = class MusicController extends colpu.Controller {
  /**
   * @api {get} /api/music/list 获取全局配置
   * @apiDescription 获取全局配置
   * @apiGroup  全局配置接口
   * @apiVersion 1.0.0
   *
   * @apiSuccess {Number} status 状态码
   * @apiSuccess {String} message 消息
   * @apiSuccess {Object} data 返回结果
   * @apiSuccessExample {json} Success-Response:
   * HTTP/1.1 200 OK
      {
        "data": {
          ...
        },
        "status": 0,
        "message": "ok"
      }
  */
  async list(ctx) {
    const { config, utils } = ctx;
    await ctx.validateAsync({
      query: {
        type: Joi.string().required(),
        page: Joi.number().integer(),
        size: Joi.number().integer(),
      },
      status: 10001,
    });
    const { type, page = 1, size = 20 } = ctx.query;
    const query = { type, page, size };
    const res = await this.service.music.list(query);
    ctx.respondEncrypt(res);
  }
};
